package today.rocky.elegantcoding.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import today.rocky.elegantcoding.common.CommonResult;

import java.io.FileNotFoundException;

/**
 * @author Rocky
 * @version 1.0
 * @date 2020/5/19 12:00
 */
@RestController
@RequestMapping("/visit")
public class VisitController {

	@RequestMapping("/test1")
	public CommonResult testThrowExp() throws FileNotFoundException, InterruptedException {
		Thread.sleep(100);
		String a = "abc";
		return CommonResult.success(a);
	}

	@RequestMapping("/test2")
	public CommonResult test() throws FileNotFoundException, InterruptedException {
		Thread.sleep(50);
		String a = "abc";
		return CommonResult.success(a);
	}

	@RequestMapping("/errorPage")
	public CommonResult error(){
		return CommonResult.failed("访问过于频繁");
	}

}
